import 'package:dio/dio.dart';

class MyDio {
  MyDio({this.args});

  final Map<String, dynamic>? args;

  var baseUrl = 'http://flycan.ren:8026';

  Future<Response> requestData(api,
      {Map<String, dynamic>? params, Object? data, method}) async {
    Dio dio = Dio();
    dio.options.baseUrl = baseUrl;
    dio.options.method = method;
    var response;
    if(method=='GET'){
      response = await dio.get(api, queryParameters: params, data: data);
    }else if(method=='POST'){
      response = await dio.post(api, data: data,queryParameters: params);
    }
    
    return response;
  }
}
